package com.zyz.L_泛型.泛型使用;

/**
 * @author: vick
 * @Date: 2025/4/2
 * @Description:
 * @version: 1.0
 */
public class Circle implements Comparable<Circle>{
    private double radius;

    public Circle(double radius) {
        this.radius = radius;
    }

    public double getRadius() {
        return radius;
    }

    public void setRadius(double radius) {
        this.radius = radius;
    }

    @Override
    public String toString() {
        return "Circle{" +
                "radius=" + radius +
                '}';
    }

    @Override
    public int compareTo(Circle o) {
        return Double.compare(this.getRadius(), o.getRadius());
    }

    /*@Override
    public int compareTo(Object o) {
        if (this == o) {
            return 0;
        }
        if (o instanceof Circle) {
            Circle circle = (Circle) o;
            return Double.compare(this.getRadius(), circle.getRadius());
        }
        throw new RuntimeException("输入的类型不匹配");
    }*/
}
